#include <iostream>

class calc
{
	int s1, s2, s3;
private:
	int a;
	int b;
	int r;

	void print (int r);

public:
	int a1, b1, r1;
	int add (int a, int b);	

};

#if 0
int calc::add (int x, int y)
{
	int z;

	z = x+y;


	return z;

}
#endif

calc c;

int calc::add (int x, int y)
{
	int r1=0;
	
	a = x;
	b = y;

	r = a+b;

	c.r=r;

	print (r);

	r1 = r;
	

	return r1;

}

void calc::print(int a)
{
	printf ("global member data = %d\n", c.r);
	printf ("local member data = %d\n", a);
}



#if 1
int main (void)
{
	calc c1;
	int x, y, z;
/*
	c1.a = 10;
	c1.b = 20;

	c1.r = c1.add (c1.a, c1.b);
*/
	x=10;
	y=20;

	z=c1.add (x,y);
	printf ("%d\n", z);

	c1.a1 = 100;
	c1.b1 = 200;

	c1.r1 = c1.add (c1.a1,c1.b1);
	printf ("%d\n", c1.r1);
//	c1.print (c1.r1);

	/*
	calc c2;
	c2.s1 = 1000;
	c2.s2 = 2000;

	c2.s3 = add (c2.s1, c2.s2);
*/

	return 0;
}
#endif


#if 0
#include <iostream>
using namespace std; 
class CRectangle { 
    int x, y; 
  public: 
    void set_values (int,int); 
    int area () {return (x*y);} 
}; 
void CRectangle::set_values (int a, int b) { 
  x = a; 
  y = b; 
} 
int main () { 
  CRectangle rect; 
  rect.set_values (3,4); 
  cout << "area: " << rect.area(); 
  return 0; 
} 
#endif